package pers.xiaojun.boot.module.system.dao.mapper.dept;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import pers.xiaojun.boot.module.system.dao.entity.dept.UserPostDO;

import java.util.List;

/**
 * 用户岗位数据访问层
 *
 * @author xiaojun
 * @since 2025-11-02
 */
@Mapper
public interface UserPostMapper extends BaseMapper<UserPostDO> {

    /**
     * 根据用户Id获取用户岗位
     *
     * @param userId 用户Id
     * @return 用户岗位
     */
    default List<Long> selectPostIdsByUserId(Long userId) {
        return selectObjs(new LambdaQueryWrapper<UserPostDO>()
                .select(UserPostDO::getPostId)
                .eq(UserPostDO::getUserId, userId)
        );
    }

}
